@use "sass:map";
@use "../variable";
@use "../helper";

.badge > tbody > tr > td {
  display: inline-block;
  padding: .25 * variable.$font-size-base .4 * variable.$font-size-base;
  font-size: 75%;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 4px;
}

@each $name, $theme in variable.$btn-themes {
  .badge-#{$name} td {
    background-color: helper.hex(map.get($theme, "background-color"));
  }
  .badge-#{$name} td span {
    background-color: helper.hex(map.get($theme, "background-color"));
    color: helper.hex(map.get($theme, "color"));
    border-color: helper.hex(map.get($theme, "border-color"));
  }
}

// Pill badges
.badge-pill > tbody > tr > td {
  padding-right: .6 * variable.$font-size-base;
  padding-left: .6 * variable.$font-size-base;
  border-radius: variable.$border-radius-pill;
}

// Make badge text 75% smaller when in a header
h1 {
  .badge > tbody > tr > td {
    font-size: .75 * 2.25 * variable.$font-size-base;
  }
}
h2 {
  .badge > tbody > tr > td {
    font-size: .75 * 2 * variable.$font-size-base;
  }
}
h3 {
  .badge > tbody > tr > td {
    font-size: .75 * 1.75 * variable.$font-size-base;
  }
}
h4 {
  .badge > tbody > tr > td {
    font-size: .75 * 1.5 * variable.$font-size-base;
  }
}
h5 {
  .badge > tbody > tr > td {
    font-size: .75 * 1.25 * variable.$font-size-base;
  }
}
h6 {
  .badge > tbody > tr > td {
    font-size: .75 * variable.$font-size-base;
  }
}
